Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PUP-11326) Make regsubst() sensitive-aware #8799

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

cocker-cc
Copy link
Contributor

@cocker-cc cocker-cc commented Oct 22, 2021

PUP-11326

Possible Use-Case out of Real-Life:

      $_ssl_key = $::facts['os']['family'] ? {                           
        'windows' => regsubst($ssl_key, '\n', "\r\n", 'EMG'),            
        default   => $ssl_key,                                           
      }

@cocker-cc cocker-cc requested a review from a team October 22, 2021 11:42
@puppetlabs-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@cocker-cc cocker-cc requested review from a team October 22, 2021 11:42
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from e3d1ea9 to ed4a58a Compare October 22, 2021 11:48
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from ed4a58a to 520b873 Compare October 22, 2021 12:34
@cocker-cc cocker-cc changed the title Make regsubst() sensitive-aware (PUP-11326) Make regsubst() sensitive-aware Oct 22, 2021
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 520b873 to 4ec8679 Compare January 17, 2022 12:47
@cocker-cc cocker-cc requested a review from a team as a code owner January 17, 2022 12:47
@CLAassistant
Copy link

CLAassistant commented Feb 7, 2022

CLA assistant check
All committers have signed the CLA.

@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 4ec8679 to bd61004 Compare February 7, 2022 19:02
@joshcooper
Copy link
Contributor

Thanks @cocker-cc you'll want to rebase this PR against #8879 after it's merged to resolve the rspec issue on Ruby 3

@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from bd61004 to b8a49d2 Compare February 23, 2022 01:51
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from b8a49d2 to 4a556d2 Compare February 23, 2022 10:11
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 4a556d2 to b998ce7 Compare April 14, 2022 21:00
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch 3 times, most recently from 320fc93 to a7dc145 Compare July 29, 2022 15:18
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from a7dc145 to 10c8b22 Compare August 30, 2022 11:32
@hlindberg
Copy link
Contributor

There is one more possible Sensitive permutation to support - that of Sensitive[Array] where the array may contain sensitives or strings. That case may be difficult to describe in the dispatch section since a Sensitive type does not present more than the base type of its content. Easiest is probably to have one dispatch for Sensitive[Array] that unwraps the Array and then recursively calls the function to get the type checking.
Not sure how valuable it is to also support that case.

@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from cff4ef6 to 6ebddd7 Compare October 17, 2022 11:57
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 6ebddd7 to 425a6f3 Compare April 21, 2023 12:40
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 425a6f3 to 6d30ad8 Compare June 19, 2023 12:17
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 6d30ad8 to aac6132 Compare August 4, 2023 11:28
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from aac6132 to 92f6efd Compare September 20, 2023 11:08
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch 2 times, most recently from 92b15f6 to 6b4a0ae Compare October 5, 2023 08:55
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from 6b4a0ae to a580772 Compare November 7, 2023 10:26
@joshcooper joshcooper added the enhancement New feature or request label Nov 15, 2023
@cocker-cc cocker-cc force-pushed the Make_regsubst_sensitive-aware branch from a580772 to c8975ba Compare June 13, 2024 20:02
@AriaXLi AriaXLi force-pushed the Make_regsubst_sensitive-aware branch from 0addbdb to 550af99 Compare October 22, 2024 23:05
@AriaXLi AriaXLi force-pushed the Make_regsubst_sensitive-aware branch from 550af99 to 3997234 Compare October 24, 2024 21:52
This commit updates regsubst() to take in Sensitive type targets. Specifically,
regsubst() can now take targets that are either Sensitive String, Sensitive
arrays that have a combination of String and/or Sensitive[String], or
non-Sensitive arrays that have combination of String and/or Sensitive[String].

Co-authored-by: Henrik Lindberg <563066+hlindberg@users.noreply.github.com>
Co-authored-by: Aria Li <aria.li@puppet.com>
@AriaXLi AriaXLi force-pushed the Make_regsubst_sensitive-aware branch from 3997234 to 0bf1a6b Compare October 24, 2024 22:19
@mhashizume
Copy link
Contributor

Thanks for your contribution @cocker-cc !

@mhashizume mhashizume merged commit 8fcce5c into puppetlabs:main Oct 28, 2024
11 checks passed
@cocker-cc cocker-cc deleted the Make_regsubst_sensitive-aware branch October 28, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants